<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<ui:composition template="/templatePrincipal.xhtml" xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:rich="http://richfaces.org/rich">

    <ui:define name="conteudo">
        <script type="text/javascript">
            function limparCampos(){
                document.getElementById("fpEquipamentos:itTipoEquipamento").value = '';
                document.getElementById("fpEquipamentos:itIdentificadaoEquipamento").value = '';
                document.getElementById("fpEquipamentos:itModeloEquipamento").value = '';
                document.getElementById("fpEquipamentos:somEquipamentoLocal").selectedIndex = 0;
            }
        </script>
        <rich:spacer height="20"/>
        <center>
            <rich:messages layout="table"
                           errorClass="errorClass"
                           infoClass="infoClass"
                           warnClass="warnClass"
                           styleClass="painelMensagem"
                           ajaxRendered="true"/>
        </center>
        <rich:spacer height="10"/>
        <rich:simpleTogglePanel switchType="client">
            <f:facet name="header">
                #{messages.cadastroEquipamentos}
            </f:facet>

            <h:form id="fpEquipamentos">
                <h:panelGrid cellspacing="2" cellpadding="2" columns="2" columnClasses="field-names, fields">

                    <h:outputLabel for="itTipoEquipamento">
                        #{messages.tipoEquipamento}:
                    </h:outputLabel>

                    <h:inputText id="itTipoEquipamento" value="#{equipamentoCriarAction.paramTipoEquipamento}" style="width:220px;"/>
                </h:panelGrid>

                <h:panelGrid cellspacing="2" cellpadding="2" columns="2" columnClasses="field-names, fields">
                    <h:outputLabel for="itModeloEquipamento" styleClass="required-black">
                        #{messages.identificacaoEquipamento}:
                    </h:outputLabel>

                    <h:inputText id="itIdentificadaoEquipamento" required="true" value="#{equipamentoCriarAction.paramIdentificacaoEquipamento}" style="width:220px;"/>
                </h:panelGrid>

                <h:panelGrid cellspacing="2" cellpadding="2" columns="2" columnClasses="field-names, fields">
                    <h:outputLabel for="itIdentificadaoEquipamento">
                        #{messages.modeloEquipamento}:
                    </h:outputLabel>

                    <h:inputText id="itModeloEquipamento" value="#{equipamentoCriarAction.paramModeloEquipamento}" style="width:220px;"/>
                </h:panelGrid>

                <h:panelGrid cellspacing="2" cellpadding="2" columns="2" columnClasses="field-names, fields">
                    <h:outputLabel for="somEquipamentoLocal" styleClass="required-black">
                        #{messages.localEquipamento}:
                    </h:outputLabel>

                    <h:selectOneMenu id="somEquipamentoLocal" value="#{equipamentoCriarAction.localSelecionado}" required="true">
                        <s:selectItems value="#{equipamentoCriarAction.listaLocais}" var="e" label="#{e.nome}" itemValue="#{e.idLocal}" noSelectionLabel="..." />
                    </h:selectOneMenu>

                    <!--h:panelGroup>
                        <h:inputText id="itDataCadastro" value="#{usuarioCriarAction.usuario.login}" size="10">
                            <rich:jQuery selector="#itPacienteDoacaoSangueA" query="mask('99/99/9999')" timing="onload"/>
                            <f:convertDateTime type="date" pattern="#{messages.dataFormatoPadraoData}" timeZone="#{messages.dataTimeZone}"/>
                        </h:inputText>
                    </h:panelGroup-->
                </h:panelGrid>
                <br/>
                <h:commandLink id="clCriar"
                               action="#{equipamentoCriarAction.criar}"
                               styleClass="link dr-toolbar-ext rich-toolbar">
                    <h:graphicImage value="/resources/images/dialog-ok-old.png"/>
                    <h:outputText value="#{messages.botaoOk}"/>
                </h:commandLink>

                <h:commandLink id="clLimpar"
                               immediate="true"
                               onclick="limparCampos()"
                               styleClass="link dr-toolbar-ext rich-toolbar">
                    <h:graphicImage value="/resources/images/edit-clear.png"/>
                    <h:outputText value="#{messages.botaoLimpar}"/>
                </h:commandLink>

                <h:commandLink id="clVoltar"
                               immediate="true"
                               action="equipamentos"
                               styleClass="link dr-toolbar-ext rich-toolbar">
                    <h:graphicImage value="/resources/images/edit-undo.png"/>
                    <h:outputText value=" #{messages.botaoVoltar}" />
                </h:commandLink>
            </h:form>
        </rich:simpleTogglePanel>
    </ui:define>
</ui:composition>